package com.example.shixun1server.dao;

import com.example.shixun1server.bean.Comments;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommentsDao extends JpaRepository<Comments,Integer> {
    //原生的查询语句 Dao方法对应起来
    @Query(value = "select * from t_comments where foodid=?1 order by postdate=?2",nativeQuery = true)
    List<Comments> findByFoodId(Integer foodid, String order);
}
